#pragma once

#include "stddef.h"

__attribute__ ((__nothrow__)) 
size_t malloc_usable_size (void *ptr);

__attribute__ ((__nothrow__ , __malloc__ , __alloc_size__ (1) )) 
void* malloc(size_t size);

__attribute__ ((__nothrow__ , __malloc__ , __alloc_size__ (1, 2) )) 
void* calloc(size_t unit_size, size_t nr);

__attribute__ ((__nothrow__ , __malloc__ , __alloc_size__ (2) )) 
void* realloc(void *ptr, size_t size);

__attribute__ ((__nothrow__)) 
void free(void *ptr);

__attribute__ ((__nothrow__)) 
int posix_memalign(void **mem_ptr, size_t alignment, size_t size);

__attribute__ ((__nothrow__ , __malloc__ , __alloc_size__ (2) )) 
void* memalign(size_t alignment, size_t size);

__attribute__((__nothrow__, __malloc__, __alloc_size__(2)))
void *aligned_alloc(size_t alignment, size_t size);

__attribute__ ((__nothrow__ , __malloc__ , __alloc_size__ (1) )) 
void* valloc(size_t size);

__attribute__ ((__nothrow__ , __malloc__)) 
void* pvalloc(size_t size);

__attribute__ ((__nothrow__))
int mallopt(int param, int value);

__attribute__ ((__nothrow__))
struct mallinfo mallinfo();

__attribute__ ((__nothrow__))
void malloc_stats(void);

#include <stdio.h>

__attribute__ ((__nothrow__))
int malloc_info(int options, FILE *stream);

__attribute__ ((__nothrow__))
int malloc_trim(size_t pad);

__attribute__ ((__nothrow__))
void *malloc_get_state(void);

__attribute__ ((__nothrow__))
int malloc_set_state(void *state);

void* __libc_malloc(size_t size) __attribute__ ((__nothrow__));
void __libc_free(void* ptr) __attribute__ ((__nothrow__));
void* __libc_realloc(void* ptr, size_t size) __attribute__ ((__nothrow__));
void* __libc_calloc(size_t n, size_t size) __attribute__ ((__nothrow__));
void __libc_cfree(void* ptr) __attribute__ ((__nothrow__));
void* __libc_memalign(size_t align, size_t s) __attribute__ ((__nothrow__));
void* __libc_valloc(size_t size) __attribute__ ((__nothrow__));
void* __libc_pvalloc(size_t size) __attribute__ ((__nothrow__));
int __posix_memalign(void** r, size_t a, size_t s) __attribute__ ((__nothrow__));